package com.amumu.drama.common.modules.alipay.config;

import com.amumu.drama.common.modules.alipay.dto.AliPayBean;
import com.ijpay.alipay.AliPayApiConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author sunzhuang
 * @date 2024/7/4 10:42
 * @slogan 天下风云出我辈, 一入代码岁月催
 * @desc todo
 */

@Component
public class AliPayConfig {

    @Bean
    public AliPayApiConfig getAliPayConfig(AliPayBean aliPayBean) {

        return AliPayApiConfig.builder()
                .setAppId(aliPayBean.getAppId())
                .setServiceUrl(aliPayBean.getServerUrl())
                .setAliPayPublicKey(aliPayBean.getPublicKey())
                .setPrivateKey(aliPayBean.getPrivateKey())
                .setAppCertPath(aliPayBean.getAppCertPath())
                .setAliPayCertPath(aliPayBean.getAliPayCertPath())
                .setAliPayRootCertPath(aliPayBean.getAliPayRootCertPath())
                .build();
    }
}
